package com.wzp;

import com.wzp.pojo.Person;

import java.util.ArrayList;
import java.util.List;

/**
 * Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
 *
 * @author wangzhengpeng
 */
public class HelloHeapOutOfMemory {

    public static void main(String[] args) {
        System.out.println("HelloHeapOutOfMemory");
        List<Person> persons = new ArrayList<>();
        int counter = 0;
        while (true) {
            persons.add(new Person());
            System.out.println("Instance:" + (++counter));
        }
    }
}